import fs from 'fs'
import { File } from 'formidable'

export const blobTobase64 = async (file: File) => {
  const filePath = file.filepath
  const fileData = fs.readFileSync(filePath)
  const base64 = fileData.toString('base64')
  return base64
}

export const fileToBytes = (file: File) => {
  const fileData = fs.readFileSync(file.filepath)
  return fileData
}
